//
//  CertificateRequest.m
//  PriceOnline
//
//  Created by Phuong Dinh Le on 3/22/13.
//  Copyright (c) 2013 WorkLikeDance. All rights reserved.
//

#import "CertificateRequest.h"

@implementation CertificateRequest

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    if ([challenge previousFailureCount])
    {
        [[challenge sender] cancelAuthenticationChallenge:challenge];
    }
    else
    {
        NSURLCredential *credential = [NSURLCredential credentialWithUser:@"username"
                                                                 password:@"password"
                                                              persistence:NSURLCredentialPersistenceForSession];
        
        [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
    }
}

@end
